from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token

from meiduo_admin.views import group
from meiduo_admin.views import images
from meiduo_admin.views import orders
from meiduo_admin.views import specs
from meiduo_admin.views import statistical
from meiduo_admin.views import users,skus,permissions
from rest_framework.routers import DefaultRouter

urlpatterns=[
    url(r'^authorizations/$', obtain_jwt_token),
    url(r'^statistical/total_count/$', statistical.UserTotalCountView.as_view()),
    # 当日活跃
    url(r'^statistical/day_active/$', statistical.UserActiveCountView.as_view()),
    #当日新增
    url(r'^statistical/day_increment/$', statistical.UserDayCountView.as_view()),
    # 当日下单
    url(r'^statistical/day_orders/$', statistical.UserOrderCountView.as_view()),
    # 月下单
    url(r'^statistical/month_increment/$', statistical.UserMonthCountView.as_view()),
    #分类访问量统计
    url(r'^statistical/goods_day_views/$', statistical.GoodsDayView.as_view()) ,
    #-----------用户
    url(r'^users/$',users.UserView.as_view()),
    #----------SPU规格 get
    url(r'^goods/simple/$',specs.Specsview.as_view({'get':'simple'})),
    #----------SKU图片
    url(r'^skus/simple/$',images.ImageView.as_view({'get':'simple'})),
    # ----------SKU--specs规格信息
    url(r'^goods/(?P<pk>\d+)/specs/$', skus.SKUSview.as_view({'get': 'specs'})),
    # ----------权限分类信息
    url(r'^permission/content_types/$', permissions.PermissionView.as_view({'get': 'content_type'})),
]
#----------SPU规格
router = DefaultRouter()
router.register('goods/specs',specs.Specsview,base_name='specs')
urlpatterns += router.urls

#----------SKU图片
router = DefaultRouter()
router.register('skus/images',images.ImageView,base_name='images')
urlpatterns += router.urls


#----------SKU
router = DefaultRouter()
router.register('skus',skus.SKUSview,base_name='skus')
urlpatterns += router.urls


#----------订单信息
router = DefaultRouter()
router.register('orders',orders.OrdersView,base_name='orders')
urlpatterns += router.urls


#----------权限信息
router = DefaultRouter()
router.register('permission/perms',permissions.PermissionView,base_name='perms')
urlpatterns += router.urls
print(router.urls)

#----------权限组信息
router = DefaultRouter()
router.register('permission/groups',group.GroupView,base_name='groups')
urlpatterns += router.urls
print(router.urls)